const gulp = require('gulp');
const sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
const base64 = require('gulp-base64');
gulp.task('scss',function () {
    gulp.src('src/scss/**/*.scss')
        .pipe(sass())
        .pipe(base64({
            baseDir: 'src',
            extensions: [/\.png#datauri$/i, /\.jpg#datauri$/i],
            maxImageSize: 8*1024, // bytes
            debug: true
        }))
        .pipe(gulp.dest('dist/css/'))
        .pipe(reload({
            stream:true
        }))
});
gulp.task('html',function () {
    gulp.src('src/**/*.html')
        .pipe(gulp.dest('dist/'))
        .pipe(reload({
            stream:true
        }));
});

gulp.task('default',function () {
    browserSync.init({
        server:'./',
        port:8080
    });
    gulp.watch('src/**/*.html',['html'])
    gulp.watch('src/scss/**/*.scss',['scss']);
});